package com.peanut.youfupay.service.other.invoice;


import com.alibaba.fastjson.JSON;
import com.peanut.youfupay.entity.request.QueryInvoiceResultRequestDTO;
import com.peanut.youfupay.entity.response.QueryInvoiceResultResponseDTO;
import com.peanut.youfupay.entity.response.ResponseMessage;
import com.peanut.youfupay.enums.FunCodeEnum;
import com.peanut.youfupay.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 商户查询开票结果
 *
 * @author peanut
 */
@Slf4j
@Service("queryApplyInvoiceResultService")
public class QueryApplyInvoiceResultService extends BaseService {
    /**
     * @param funCodeEnum
     * @param queryInvoiceResultRequestDTO
     * @return
     * @throws Exception
     */
    public List<QueryInvoiceResultResponseDTO> doBusiness(FunCodeEnum funCodeEnum, QueryInvoiceResultRequestDTO queryInvoiceResultRequestDTO) throws Exception {
        log.info("查询开票结果开始:{}，{}", funCodeEnum, queryInvoiceResultRequestDTO);
         ResponseMessage responseMessage = applyYouFuByHttpPost(funCodeEnum, queryInvoiceResultRequestDTO);
        List<QueryInvoiceResultResponseDTO> queryInvoiceResultResponseDTOS = JSON.parseArray(responseMessage.getResData(), QueryInvoiceResultResponseDTO.class);
        log.info("查询开票结果结束:{}", queryInvoiceResultResponseDTOS);
        return queryInvoiceResultResponseDTOS;
    }
}





